package com.daz.system.admin.web.food;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.daz.common.component.entity.ResponseVO;
import com.daz.common.component.util.ResultUtil;
import com.daz.mysql.repository.entity.food.FoodDO;
import com.daz.mysql.repository.service.food.FoodIService;
import com.daz.system.admin.web.food.dto.FoodSearchDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.*;

/**
 * @description 食物控制器
 * @author dingazheng
 * @since 2024/06/29
 */
@RestController
@RequestMapping("/food")
public class FoodController {
    @Autowired
    private FoodIService foodIService;
    @PostMapping("/listPage")
    public ResponseVO listPage(@RequestBody FoodSearchDTO dto){
        Page<FoodDO> foodDOPage = new Page<>(dto.getPageNum(), 2);
        IPage<FoodDO> foodDOIPage = foodIService.page(foodDOPage, new LambdaQueryWrapper<>());
        return ResultUtil.success(foodDOIPage);
    }
}
